package com.lcm.oj.lanqiao.year2021.moni.c2;

import java.util.Scanner;

/**
 * @author Coder-lcm
 * @date 2021/4/17
 */
public class T7 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int t = scanner.nextInt();
        if ((b + t) / 60 > 0) {
            a += (b + t) / 60;
            b = (b + t) % 60;
        }else {
            b += t;
        }

        System.out.println(a);
        System.out.println(b);
    }

}
